import api from '@/utils/request'

export const getAllUserList = () => {
    return api.get('/Admin/sysUser/all')
}

export const addSysUser = (data: any) => {
    return api.post('/Admin/sysUser/add', data)
}

export const editSysUser = (data: any) => {
    return api.post('/Admin/sysUser/editUserByUserId', data)
}

export const resetPassword = (data: any) => {
    return api.post('/Admin/sysUser/resetPassword', data)
}

export const resetPasswordValid = (data: any) => {
    return api.post('/Admin/sysUser/resetPasswordValid', data)
}

export const deleteSysUserById = (userId: string) => {
    return api.post('/Admin/sysUser/deleteUserByUserId?userId=' + userId)
}


export const login = (data: any) => {
    return api.post('/Admin/account/login', data)
}

export const logout = () => {
    return api.post('/Admin/account/logout')
}

export const getOnlineUserList = () => {
    return api.get('/Admin/sysUser/getOnlineUser')
}

export const forceOfflineUserList = (sessionId: string) => {
    return api.post('/Admin/sysUser/forceOfflineUser?sessionId=' + sessionId)
}

export const getOnlineUserByWebSocket = () => {
    return api.get('/Admin/sysUser/getOnlineUserByWebSocket')
}


export const forceOfflineUserBySSE = (username: string, ip: string) => {
    return api.post('/Admin/sysUser/forceOfflineUserBySSE?username=' + username + '&ip=' + ip)
}


export const getUserList = (date: string) => {
    return api.get('/Admin/account/testActive/getOneDay?date=' + date)
}